package com.red.star.wechat.data.mappers;

import com.red.star.wechat.data.core.base.MyMapper;
import com.red.star.wechat.data.entity.MonthlyMerchantPoster;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MonthlyMerchantPosterMapper extends MyMapper<MonthlyMerchantPoster> {

    List<MonthlyMerchantPoster> getMonthlyMerchantPoster(MonthlyMerchantPoster monthlyMerchantPoster);

    /**
     * 查询某一月是否有数据
     * @param time 时间(月)
     * @return 某月数据数量(大于0则有数据)
     */
    @Select("SELECT COUNT(*) AS totalCount FROM stat_monthly_merchant_poster WHERE time = #{time}")
    Integer countMonthlyMerchantPoster(@Param("time") String time);

    @Delete("delete from stat_monthly_merchant_poster where time=#{monthTime}")
    Integer deleteByMonthTime(@Param("monthTime") String monthTime);
}
